home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness:…ecision-Making Strategies / Workplace Effectiveness: Decision-Making Strategies.iso / pc / Files / Main.dxr / 00008_Pushbutton 2nd sprite, script.ls < prev    next >
Encoding:
Text File  |  1998-12-16  |  2.4 KB  |  60 lines

  1. property UpCM, DownCM, UpNum, DownNum, changeSprite, button_active, runScript, scriptLoc
  2.  
  3. on mouseDown me
  4.   set the member of sprite the changeSprite of me to member the DownCM of me
  5.   set the loc of sprite the changeSprite of me to point(320, 240)
  6.   set the button_active of me to 1
  7. end
  8.  
  9. on mouseUp me
  10.   if the button_active of me then
  11.     set the loc of sprite the changeSprite of me to point(-4444, -4444)
  12.     set the button_active of me to 0
  13.     call(runScript, script scriptLoc)
  14.   end if
  15. end
  16.  
  17. on mouseEnter me
  18.   if the button_active of me then
  19.     set the loc of sprite the changeSprite of me to point(320, 240)
  20.   end if
  21. end
  22.  
  23. on mouseLeave me
  24.   if the button_active of me then
  25.     set the loc of sprite the changeSprite of me to point(-4444, -4444)
  26.   end if
  27. end
  28.  
  29. on mouseUpOutSide me
  30.   set the button_active of me to 0
  31. end
  32.  
  33. on beginSprite me
  34.   set the UpCM of me to the member of sprite the spriteNum of me
  35.   set the UpNum of me to the number of member UpCM
  36.   set the DownNum of me to the number of member DownCM
  37.   set the button_active of me to 0
  38. end
  39.  
  40. on endSprite me
  41. end
  42.  
  43. on getPropertyDescriptionList
  44.   if the currentSpriteNum = 0 then
  45.     set memdefault to 0
  46.   else
  47.     set memref to the member of sprite the currentSpriteNum
  48.     set memName to the name of member memref
  49.     set downName to memName && "dn"
  50.     set castLibNum to the castLibNum of memref
  51.     set memdefault to member downName of castLib castLibNum
  52.   end if
  53.   set p_list to [#DownCM: [#comment: "Hilite Image:", #format: #graphic, #default: memdefault], #changeSprite: [#comment: "The other sprite to change:", #format: #integer, #default: 120], #runScript: [#comment: "Handler to activate:", #format: #symbol, #default: #empty], #scriptLoc: [#comment: "Which is in member:", #format: #script, #default: EMPTY]]
  54.   return p_list
  55. end
  56.  
  57. on getBehaviorDescription
  58.   return "Makes a sprite work as a pushbutton with automatic highlighting and mouse tracking. The sprite's initial castmember represents the button's normal state." & RETURN & "PARAMETERS:" & RETURN & "‚Ä¢ Hilite Image - Member to display when the button is pressed. The default is the same name followed by a SPACE and dn" & RETURN & "‚Ä¢ The sprite channel that shows the down state." & RETURN & "-- Activates a different sprite to change for the down state, sending it to the center of the stage." & RETURN & "‚Ä¢ The script to run and its cast member location, so it's compiled with the behavior."
  59. end
  60.